import React, { PureComponent } from 'react'
import { Carousel } from 'antd-mobile'
import PropTypes from 'prop-types'
import ResponsiveImage from '@/components/ResponsiveImage'
export default class Swiper extends PureComponent {
    static propTypes = {
        data: PropTypes.array.isRequired
    }
    static defaultProps = {
        data: []
    }
    render() {
        const { data } = this.props
        if (!data.length) {
            return null
        }
        return (
            <Carousel
                autoplay={true}
                infinite
                dotActiveStyle={{'backgroundColor': '#fb7299'}}
            >
                {
                    data.map(item => {
                        return <ResponsiveImage key={item.id} src={item.pic} />
                    })
                }
            </Carousel>
        )
    }
}
